#include "graph_support/TestGraphUniversal.h"

#include "graph_support/utils/test_my_graph/UnifiedGraphTestTemplate.h"

#include "graph_support/impls/vector/VectorGraph.h"
#include "graph_support/impls/matrix/MatrixGraph.h"
#include "graph_support/impls/compact/CompactGraph.h"
#include "graph_support/fakes/ChessBoard.h"

using namespace GRAPH_SUPPORT_NS::impls::vector;
using namespace GRAPH_SUPPORT_NS::impls::matrix;
using namespace GRAPH_SUPPORT_NS::impls::compact;

// TODO 5 Unified
void TestRunUniversalTest4MatrixGraph()
{
	RUN_UNIFIED_TEST_CASE( MatrixGraphTmpl );
}

void TestRunUniversalTest4VectorGraph()
{
	RUN_UNIFIED_TEST_CASE( VectorGraphTmpl );
}

void TestRunUniversalTest4CompactGraph()
{
	RUN_UNIFIED_TEST_CASE( CompactGraphTmpl );
}

void TestRunUniversalTest4KnightsWalking()
{
	using namespace GRAPH_SUPPORT_NS::attributes;
	using namespace GRAPH_SUPPORT_NS::utils::test_my_graph;
	using namespace GRAPH_SUPPORT_NS::impls;
	using namespace GRAPH_SUPPORT_NS::impls::vector;
//	using namespace test_gs_fakes;

	ChessBoard chbrd( 8, 8 );
	BOOST_CHECK_EQUAL( computeKnightOutcomes( 8, 8 ), testEasyGraphAccess( chbrd ) );
	BOOST_CHECK_EQUAL( 336, testEasyGraphAccess( chbrd ) );

	std::vector< int > vec64( 64 );
	for ( int i = 0; i < vec64.size(); i++ ) vec64[i] = i;
	VectorGraphTmpl< int, LengthEdgeAttributesTmpl< int > > expectedGraph( vec64 );
	expectedGraph.addEdge( chbrd.vert2num( ChessBoard::GrVertex( 3, 3 ) ), chbrd.vert2num( ChessBoard::GrVertex( 3, 3 ) ), 0 );
	expectedGraph.addEdge( chbrd.vert2num( ChessBoard::GrVertex( 3, 3 ) ), chbrd.vert2num( ChessBoard::GrVertex( 5, 4 ) ), 1 );
	expectedGraph.addEdge( chbrd.vert2num( ChessBoard::GrVertex( 3, 3 ) ), chbrd.vert2num( ChessBoard::GrVertex( 7, 5 ) ), 2 );
	expectedGraph.addEdge( chbrd.vert2num( ChessBoard::GrVertex( 3, 3 ) ), chbrd.vert2num( ChessBoard::GrVertex( 6, 3 ) ), 3 );
	testDejkstra( chbrd, ChessBoard::GrVertex( 3, 3 ), expectedGraph );
}
